<template>
  <div class="form-view-row">
    <label>{{ field.displayName }}</label>
    <div class="form-view-row-content">
      {{ displayName }}
    </div>
  </div>
</template>

<script>
export default {
  name: 'FormTagView',
  props: {
    field: {
      type: Object,
      default: () => ({}),
    },
    value: {
      type: [Array, Object],
    },
  },
  computed: {
    _multiple() {
      let { isMultiple } = this.field.setting || {};
      return isMultiple == 1;
    },
    displayName() {
      // 多选
      if (Array.isArray(this.value)) {
        return this.value.map(i => i.displayName || i.name).join(',');
      }

      let tag = this.value || {};
      return tag.displayName || tag.name;
    },
  },
};
</script>
<style scoped lang="scss"></style>
